package controlLayer;

import java.util.ArrayList;

import modelLayer.Customer;
import modelLayer.CustomerContainer;
import modelLayer.RegularCustomer;

public class CustomerController{
	public Customer findCustomer(int cprNo){
		ArrayList<Customer> customers = CustomerContainer.getInstance().getAllCustomers();
		for(Customer c : customers)
			if(c.getCprNo() == cprNo)
				return c;
		return null;
	}
	public double getDiscount(int cprNo){
		Customer c = findCustomer(cprNo);
		if(c != null){
			if(c instanceof RegularCustomer)
				return ((RegularCustomer)c).getDiscount();
		}
		return 0;
	}
}
